package com.aba.cms5zu.houseparent;
import java.util.ArrayList;
import java.util.List;
import com.aba.cms5zu.student.Student;

public class Houseparent {
     private List<Student> studentList = new ArrayList<>(); // 存储学生信息
     private List<RepairRequest> repairRequests = new ArrayList<>(); // 新增：存储维修申请

        // 登录验证（简化示例，实际需对接数据库）
        public boolean login(String username, String password) {
            return ("staff01".equals(username) || "staff02".equals(username)) 
                    && "staff123".equals(password);
        }

        public void logout() {
            System.out.println("宿管退出系统");
        }

        // 添加学生信息
        public void addStudent(Student student) {
            studentList.add(student);
            System.out.println("添加学生：" + student.getName() + " 成功");
        }
     // 接收维修申请
        public void receiveRepairRequest(RepairRequest request) {
            repairRequests.add(request);
            System.out.println("宿管：即将添加维修申请，来自 :" + request.getStudentName() + "，问题：" + request.getProblem()); // 添加调试输出
            System.out.println("宿管：收到来自 " + request.getStudentName() + " 的维修申请：" + request.getProblem());
        }

        // 查看所有维修申请
        public void viewRepairRequests() {
            System.out.println("宿管：当前的维修申请列表：");
            if (repairRequests.isEmpty()) {
                System.out.println("没有维修申请"); // 添加空列表时的输出
            } else {
            for (RepairRequest request : repairRequests) {
                System.out.println("学生：" + request.getStudentName() + "，问题：" + request.getProblem());
                }
            }
        }

        // 内部类表示维修申请
        public static class RepairRequest {
            private String studentName;
            private String problem;

            public RepairRequest(String studentName, String problem) {
                this.studentName = studentName;
                this.problem = problem;
            }

            public String getStudentName() {
                return studentName;
            }

            public String getProblem() {
                return problem;
            }
        }
}